package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IVoucherOrderService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/voucher-order")
public class VoucherOrderController {

    @Resource
    private IVoucherOrderService iVoucherOrderService;


    @PostMapping("seckill/{id}")   // 购买 一个 优惠卷 对应的 东西  只卖 他家卷
    public Result seckillVoucher(@PathVariable("id") Long voucherId) {  // 秒杀 优惠卷，
        return iVoucherOrderService.seckillVoucher(voucherId);
    }
}
